package router

import (
	"FastDevelopGo/src/base/log"
	"FastDevelopGo/src/base/mess"
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
	"net/http"
)

// 登录主网关
func loginRouter(r *gin.RouterGroup) {
	// 注册接口
	r.POST("/register", func(c *gin.Context) {
		c.JSON(http.StatusOK, mess.ResMessOK("注册用户"))
	})

	// 基础登录接口
	r.POST("/login", func(c *gin.Context) {
		username := c.DefaultPostForm("username", "")
		password := c.DefaultPostForm("password", "")
		log.Logger.Info("测试登录接口：", zap.String("username", username), zap.String("password", password))
		c.JSON(http.StatusOK, mess.ResMessOK("登录成功"))
	})

	// 日常会话验证接口
	r.POST("/authorize", func(c *gin.Context) {
		c.JSON(http.StatusOK, mess.ResMessOK("验证会话有效性"))
	})
}
